<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

  <!-- 引入样式 -->
  <link rel="stylesheet" href="../plugins/element-ui/index.css"/>
  <link rel="stylesheet" href="../styles/icon/iconfont.css"/>

</head>
<body>
<div id="app">

    <el-form  ref="ruleForm" label-width="100px" class="demo-ruleForm">
        <el-form-item label="邮箱" >
            <el-input v-model="email"></el-input>
        </el-form-item>
        <el-form-item label="密码" >
            <el-input type="password" v-model="password" autocomplete="off"></el-input>
        </el-form-item>
<!--        <el-form-item label="确认密码" prop="checkPass">-->
<!--            <el-input type="password" v-model="ruleForm.checkPass" autocomplete="off"></el-input>-->
<!--        </el-form-item>-->

        <el-form-item>
            <el-button type="primary" @click="login">提交</el-button>
            <el-button @click="reset">重置</el-button>
        </el-form-item>
    </el-form>

</div>

</body>


<script src="../plugins/vue/vue.js"></script>
<script src="../plugins/element-ui/index.js"></script>
<script src="../plugins/axios/axios.min.js"></script>
<script src="../js/request.js"></script>
<script src="../api/admin.js"></script>

<script>
    new Vue({
        el:"#app",
        data(){
            return{
                email:'',
                password:''
            }
        },
        mounted(){
        },
        methods:{
            login(){
                loginApi({
                    "email":this.email,
                    "password":this.password
                    }).then(res=>{
                        // console.log(res)
                    if (res.data.flag){
                        localStorage.setItem("token",res.data.data);
                        this.reset();
                        location.href="http://localhost:8080/pages/bloghtml/categories.html";
                    }

                })
            },
            reset(){

                token=localStorage.getItem("token");
                console.log(token)
            }
        }
    })
</script>

</html>